#include "../im.h"

std::mutex mtx;
std::condition_variable cv;
bool finished = false;

void worker_thread(std::function<void()> cb)
{
    LOG_I << "worker_thread begin";
    // 做一些工作...
    std::this_thread::sleep_for(std::chrono::seconds(2));

    // 锁定互斥量并设置finished为true
    // std::unique_lock<std::mutex> lock(mtx);
    // finished = true;
    cb();
    // // 通知主线程
    // cv.notify_one();
}

int main()
{
    std::thread worker(worker_thread, []()
                       { LOG_I << "callback"; });

    // // 等待worker线程完成
    // std::unique_lock<std::mutex>
    //     lock(mtx);
    // cv.wait(lock, []
    //         { return finished; });

    // LOG_I << "Worker thread finished!";

    worker.join();
    return 0;
}